import request from '@/utils/request'

// 查询
export function listJobInstance(query,page) {
  debugger
  const quertParam = {
    "pageSize": page.pageSize,
    "pageNum" : page.pageNum,
    "obj" : query
  }
  return request({
    url: '/server/jobInstance/list',
    method: 'post',
    data: quertParam
  })
}

/**
 * 任务暂停
 * @param {Object} machineId
 */
export function stopJobInstance(ids){
  return request({
    url: '/server/jobInstance/stopJobInstance',
    method: 'post',
    data:{"idList":ids.join(",")}
  })
}

/**
 * 任务执行
 * @param {Object} machineId
 */
export function startJobInstance(ids){
  return request({
    url: '/server/jobInstance/startJobInstance',
    method: 'post',
    data:{"idList":ids.join(",")}
  })
}

/**
 * 任务复制
 * @param {Object} machineId
 */
export function copyJobInstance(form){
  return request({
    url: '/server/jobInstance/copyJobInstance',
    method: 'post',
    data:form
  })
}

/**
 * 任务复制
 * @param {Object} machineId
 */
export function addJobInstance(form){
  return request({
    url: '/server/jobInstance/newJobInstance',
    method: 'post',
    data:form
  })
}




// 删除
export function delJobInstance(id) {
  if(typeof roleId  === 'object'){
    roleId = roleId.toString().replace(/(\")/g, "");
  }
  return request({
    url: '/server/jobInstance/delJobInstance' ,
    method: 'post',
    data:{"machineId":id}
  })
}
